package com.pickgliss.utils
{
	import com.pickgliss.toplevel.StageReferance;
	
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.utils.Dictionary;
	import flash.utils.getTimer;

	public class DebugUtils
	{
		public function DebugUtils()
		{
		}
		
		private static var _lastTimes:Dictionary;
		
		public static function traceTimeGape(id:String):void
		{
			if(_lastTimes == null)
			{
				_lastTimes = new Dictionary();
			}
			var last:int = _lastTimes[id];
			_lastTimes[id] = getTimer();
			if(last > 0)trace(id+" timeGape : "+String(_lastTimes[id] - last));
		}
		
		private static var outputField:TextField;
		public static function log(msg:String):void
		{
			if(outputField == null)
			{
				outputField = new TextField();
				StageReferance.stage.addChild(outputField);
				outputField.multiline = true;
				outputField.autoSize = TextFieldAutoSize.LEFT;
			}
			outputField.appendText(msg+"\n");
		}
	}
}